package com.mv.spring.controller;

import javax.servlet.ServletRequest;

import com.mv.spring.bean.AutoWired;
import com.mv.spring.service.Rap;
import com.mv.spring.web.mvc.Controller;
import com.mv.spring.web.mvc.RequestMapping;
import com.mv.spring.web.mvc.RequestParam;

@Controller
public class RapController {
    @AutoWired
    private Rap rapper;

    //http://localhost:8080/rap
    @RequestMapping("/rap1")
    public String rap() {
        rapper.rap();
        return   "raping1...,view console.请查看服务端控制台输出";
    }
    
    //http://localhost:8080/rap/req=5
    @RequestMapping("/rap")
    public String rap(@RequestParam(value="req")String req) {
    	System.out.println("RapController method rap start");
    	//String host = req.getRemoteHost();
        rapper.rap();
        System.out.println("get parm host:" + req);
        return   "raping...,view console.请查看服务端控制台输出";
    }
    
    //http://localhost:8080/rap2?abc=333
    @RequestMapping("/rap2")
    public String rap2(ServletRequest req) {
        rapper.rap();
        return   "raping2...,view console.请查看服务端控制台输出 value" + req.getParameter("abc") ;
    }
    //http://localhost:8080/rap2?abc=333
    @RequestMapping("/rap3")
    public String rap3(@RequestParam(value="str")String str ,ServletRequest req) {
        rapper.rap();
        return   "raping3...,view console.请查看服务端控制台输出  str value:" + str + "parms value" + req.getParameter("abc") ;
    }  
    
    //http://localhost:8080/rap2?abc=333
    @RequestMapping("/rap4")
    public String rap4(ServletRequest req,@RequestParam(value="str")String str ) {
        rapper.rap();
        return   "raping3...,view console.请查看服务端控制台输出  str value:" + str + "parms value" + req.getParameter("abc") ;
    }       
}
